/*
 * Copyright (c) 2010-2011 Plugger Antonio Begue Ponce. All Rights Reserved.
 *
 * This file is part of Plugger Framework.
 *
 *  Plugger Framework is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Lesser General Public License version 3 as published by
 *  the Free Software Foundation.
 *
 *  Plugger Framework is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public License
 *  along with Plugger Framework.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.plugger.infrastructure.domainbase;

import java.util.List;

import org.plugger.infrastructure.rules.BrokenRuleMessages;
import org.plugger.infrastructure.rules.IRule;

/**
 * Definition for a validatable for persistence domain model
 *
 * @author Antonio Begue
 * @version $Revision: 1.0 $
 *
 * @see     IRule
 * @see     BrokenRuleMessages
 */
public interface IValidatableForPersistence {
    /**
     * Verify if the entity is valid for persistence.
     *
     * @return true only when all rules are passed.
     */
    Boolean isValidForPersistence();

    /**
     * A function that collect broken rules.
     *
     * @return A collection of broken rules.
     */
    List<IRule> getBrokenPersistenceRules();

    /**
     * Returns the collection of IRules
     *
     * @return a IList of IRules
     */
    List<IRule> getPersistenceRules();

    /**
     * An function to initialize the persistence rules
     * Example: <code>getPersistenceRules().add(new MaxStringLengthRule(13, "Nombre", this));</code>
     */
    void initializePersistenceRules();

    /**
     * Returns the messages collection for broken rules.
     *
     * @return a BrokenRuleMessages object.
     */
    BrokenRuleMessages getBrokenRuleMessages();
}
